package commands;

import containers.StudentContainer;
import entities.Student;

/**
 * Assess the risk of the student applying for the loan
 * 
 * @author eks691
 */
public class AssessRisk {

	/** student doing risk assessment on */
	private Student student;

	/** Constructor for class */
	public AssessRisk(Student s) {
		student = s;
	}

	/**
	 * Do the risk assessment of a particular loan by acquiring a gross-debt
	 * ratio Gross-Debt Ratio = Monthly Expenses/ Monthly Income Since students
	 * rarely have an income, the loan must be guaranteed, therefore the
	 * co-signer is the one that needs to have a good gross-debt ratio
	 */
	public float doRiskAssessment() {
		return student.getLoan().getCosigner().getFinancialInfo()
				.getMonthlyExpenses()
				/ student.getLoan().getCosigner().getFinancialInfo()
						.getMonthlyIncome();
	}

	/**
	 * regression tests
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		Student student1 = StudentContainer.dictionary().get(123456);
		AssessRisk ar = new AssessRisk(student1);

		if (ar.doRiskAssessment() != student1.getLoan().getCosigner()
				.getFinancialInfo().getMonthlyExpenses()
				/ student1.getLoan().getCosigner().getFinancialInfo()
						.getMonthlyIncome()) {
			System.out.println("ERROR: Assessing Risk");
		}

		/*
		 * System.out.println("Name: " + student1.getName());
		 * System.out.println("CoSigner Name: " +
		 * student1.getLoan().getCosigner().getName());
		 * System.out.println("CoSigner MonthlyIncome: " +
		 * student1.getLoan().getCosigner().getFinancialInfo()
		 * .getMontlyIncome()); System.out.println("CoSigner MonthlyExpenses: "
		 * + student1.getLoan().getCosigner().getFinancialInfo()
		 * .getMonthlyExpenses());
		 * System.out.println("Gross-Debt Ratio of Cosigner: " +
		 * ar.doRiskAssessment());
		 */

	}
}
